import { Http } from "../utils/http";

class Device extends Http {
  constructor(props) {
    super(props);
  }

  add(id) {
    return this.request({
      url: "//mini/iotDevice/addDev",
      method: "post",
      data: {
        id,
      },
    });
  }
  getType(id) {
    return this.request({
      url: "//mini/iotDevice/getDevInfo",
      data: {
        id,
      },
    });
  }
  getById(id) {
    return this.request({
      url: "//mini/iotDevice/getById",
      data: {
        id,
      },
    });
  }
  getStatistic(id) {
    return this.request({
      url: "/app/devCall/getDevCallMonthCountsByDevId",
      data: {
        id,
      },
    });
  }
  alarmList(pageNo = 1, pageSize = 10, id) {
    let obj = {
      pageNo,
      pageSize,
    };
    if (id) {
      obj.id = id;
    }
    return this.request({
      url: "/mini/iotAlarmMessage/getList",
      data: obj,
    });
  }
  deviceList(id) {
    let obj = {};
    if (id) {
      obj.id = id;
    }
    return this.request({
      url: "/mini/iotDevice/list",
      data: obj,
    });
  }
}

export { Device };
